package com.pjb.springsecurity.mapper;

import com.pjb.springsecurity.domain.SysUser;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface UserMapper {
@Results({
        @Result(property="roles",javaType=List.class,column="username",many=@Many
                (select="com.pjb.springsecurity.mapper.SysRoleMapper.quaryAllSysRole"))
})
//查询出来的结果与SysUser中的roles映射
    @Select("select u.*,r.name from sys_user u LEFT JOIN sys_role_user sru on u.id= sru.sys_user_id LEFT JOIN sys_role r on sru.sys_role_id=r.id where username= #{username}")
    SysUser findByUserName(String username);

}
